package hcn.protocol.brandnew.zhenliao.jianyan;

import lombok.Data;
import javax.xml.bind.annotation.*;
import java.util.List;
import hcn.protocol.brandnew.BaseRequest;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import ctd.util.xml.jaxb.DateTimeAdapter;
import org.atag.sysrouter.annotation.DictionaryMapping;

import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;


/**
 * 检验申请信息新增-响应消息(成功) - ODS_03050010_SUC
 *
 * @author enjoyLife
 */
@Data
@XmlRootElement(name = "Data")
@XmlAccessorType(XmlAccessType.FIELD)
public class LabRequestSubmitResponse {

    /**
     * 就诊机构代码
     */
    @XmlElement(name = "VisitOrganization")
    private String visitOrganization;
    /**
     * 就诊机构名称
     */
    @XmlElement(name = "VisitOrganizationName")
    private String visitOrganizationName;
    /**
     * 业务系统患者档案ID
     */
    @XmlElement(name = "SourcePatientId")
    private String sourcePatientId;
    /**
     * 患者姓名
     */
    @XmlElement(name = "Name")
    private String name;
    /**
     * 性别代码
     */
    @XmlElement(name = "Sex")
    private String sex;
    /**
     * 身份证件号码
     */
    @XmlElement(name = "IdCard")
    private String idCard;
    /**
     * 身份证件类别代码
     */
    @XmlElement(name = "IdCardCode")
    @DictionaryMapping(id = "CV02_01_101")
    private String idCardCode;
    /**
     * 就诊卡类别代码
     */
    @XmlElement(name = "MedicalCardType")
    @DictionaryMapping(id = "rmp.dic.medicalCardType")
    private String medicalCardType;
    /**
     * 就诊卡号
     */
    @XmlElement(name = "MedicalCardId")
    private String medicalCardId;
    /**
     * 就诊流水号
     */
    @XmlElement(name = "VisitId")
    private String visitId;
    /**
     * 科室代码
     */
    @XmlElement(name = "Dept")
    private String dept;
    /**
     * 科室名称
     */
    @XmlElement(name = "DeptName")
    private String deptName;
    /**
     * 申请医师代码
     */
    @XmlElement(name = "RequestDoctor")
    private String requestDoctor;
    /**
     * 申请医生姓名
     */
    @XmlElement(name = "RequestDoctorName")
    private String requestDoctorName;
    /**
     * 申请科室代码
     */
    @XmlElement(name = "RequestDept")
    private String requestDept;
    /**
     * 申请科室名称
     */
    @XmlElement(name = "RequestDeptName")
    private String requestDeptName;
    /**
     * 检验申请单
     */
    @XmlElement(name = "LabRequest")
    private LabRequest labRequest;

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class Childitem {

        /**
         * 检验(明细)项目代码
         */
        @XmlElement(name = "ChildItemCode")
        private String childItemCode;
        /**
         * 检验(明细)项目名称
         */
        @XmlElement(name = "ChildItemName")
        private String childItemName;
        /**
         * 医嘱项目明细记录流水号
         */
        @XmlElement(name = "OrderDetailId")
        private String orderDetailId;
        /**
         * 收费项目代码
         */
        @XmlElement(name = "CostID")
        private String costID;
        /**
         * 收费项目名称
         */
        @XmlElement(name = "CostName")
        private String costName;
        /**
         * 费用单价
         */
        @XmlElement(name = "CostPrice")
        private String costPrice;
        /**
         * 费用数量
         */
        @XmlElement(name = "CostNumber")
        private String costNumber;
        /**
         * 费用单位
         */
        @XmlElement(name = "CostUnit")
        private String costUnit;
        /**
         * 小计金额
         */
        @XmlElement(name = "DetailCost")
        private String detailCost;
    }

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class Item {

        /**
         * 医嘱流水号
         */
        @XmlElement(name = "OrderId")
        private String orderId;
        /**
         * 检验项目代码
         */
        @XmlElement(name = "ItemCode")
        private String itemCode;
        /**
         * 检验项目名称
         */
        @XmlElement(name = "ItemName")
        private String itemName;
        /**
         * 标本类别代码
         */
        @XmlElement(name = "SampleTypeCode")
        private String sampleTypeCode;
        /**
         * 标本类别名称
         */
        @XmlElement(name = "SampleTypeName")
        private String sampleTypeName;
        /**
         * 注意事项
         */
        @XmlElement(name = "RequestNote")
        private String requestNote;
        /**
         * 项目单价
         */
        @XmlElement(name = "ItemPrice")
        private String itemPrice;
        /**
         * 项目数量
         */
        @XmlElement(name = "ItemCount")
        private String itemCount;
        /**
         * 项目费用
         */
        @XmlElement(name = "ItemCost")
        private String itemCost;
        /**
         * 计费标志
         */
        @XmlElement(name = "FeeStatus")
        private Boolean feeStatus;
        /**
         * 申请执行科室
         */
        @XmlElement(name = "ExamExecuteDept")
        private String examExecuteDept;
        /**
         * 申请执行科室名称
         */
        @XmlElement(name = "ExamExecuteDeptName")
        private String examExecuteDeptName;
        /**
         * 申请执行日期时间
         */
        @XmlElement(name = "ExamExecuteTime")
        @XmlJavaTypeAdapter(DateTimeAdapter.class)
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date examExecuteTime;
        /**
         * (门诊)发票号码
         */
        @XmlElement(name = "InvoiceNo")
        private String invoiceNo;
        /**
         * 检验方法名称
         */
        @XmlElement(name = "ExamMethodName")
        private String examMethodName;
        /**
         * 检验方法代码
         */
        @XmlElement(name = "ExamMethodCode")
        private String examMethodCode;
        /**
         * 检验费用类别
         */
        @XmlElement(name = "Feetype")
        private Byte feetype;
        /**
         * 免费标识
         */
        @XmlElement(name = "CostFreeSign")
        private Byte costFreeSign;
        /**
         * 项目明细集合
         */
        @XmlElementWrapper(name = "Childitems")
        @XmlElement(name = "Childitem")
        private List<Childitem> childitems;
    }

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class LabRequest {

        /**
         * 检验申请单编号
         */
        @XmlElement(name = "RequestId")
        private String requestId;
        /**
         * 检验申请单状态
         */
        @XmlElement(name = "RequestStatus")
        private Byte requestStatus;
        /**
         * 紧急标志
         */
        @XmlElement(name = "IsEmergency")
        private Boolean isEmergency;
        /**
         * 申请项目集合
         */
        @XmlElementWrapper(name = "Items")
        @XmlElement(name = "Item")
        private List<Item> items;
    }

}
